package top.hardsnail.controller;

import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.bind.DefaultValue;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import top.hardsnail.entity.User;
import top.hardsnail.service.IUserService;

/**
 * @author Tre'
 * @date 2021/2/28 15:55
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Qualifier("userServiceImpl")
    @Autowired
    private IUserService userService;

    @RequestMapping("/getUserPage")
    @ResponseBody
    public PageInfo<User> getUserPage(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize) {
        PageInfo<User> page = userService.getPage(pageNum, pageSize);
        return page;
    }
}
